<template>
  <div  class="">
    {{mss}}<br/>
    {{dan}}
    <!-- {{sf}} -->
    <div>
        <!--原版
           <button @click="$store.commit('ja',1)">+</button>
        <button @click="$store.commit('cd',1)">-</button> -->
        <!-- 改版 -->
        <button @click="ja(2)">+</button>
        <button @click="cd(1)">-</button><br/>
        <!-- mapActions改版 -->
         <button @click="jad(10)">+</button>
        <button @click="cdd(2)">-</button>
    </div>

    <zi></zi>
  </div>
</template>

<script>
import {mapState,mapMutations,mapActions,mapGetters} from 'Vuex'
import store from '@/store/store'   
import zi from '@/pc/zi'  
export default {
  name: 'apple',
  data(){
      return{
          mss:'我是pcx数据',
          sf:''
      }
  },
  methods: {
    ...mapMutations(['ja','cd']),
     ...mapActions(['jad','cdd'])
  },
  computed: {
    ...mapState(['dan']),
    //...mapState({dan:state=>state.dan})
    // ...mapGetters(['dan']),
   
  },
  components:{
    zi
  },
  watch:{
    dan:function(newVal,oldVal){
          if(newVal>=oldVal){
              console.log(this.dan+"变大了")         
          }
          else{
             console.log(this.dan+"变小了") 
          }
          console.log(2)
    }

  },

 store
 
}
</script>

<style>

</style>
